<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <span>运营商添加</span>
      <el-button style="float: right; padding: 3px 0" type="text" @click="returns">返回</el-button>
      <el-button style="float: right; padding: 3px 0" type="text" @click="addAdmin">提交</el-button>
    </div>
    <el-row>
  <el-form ref="form" :model="admin" label-width="80px">
    <el-form-item label="账号">
      <el-input v-model="admin.username"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="admin.password"></el-input>
    </el-form-item>
    <el-form-item label="邮箱">
      <el-input v-model="admin.email"></el-input>
    </el-form-item>
    <el-form-item label="创建日期">
      <el-col :span="11">
        <el-date-picker type="date" placeholder="选择日期" v-model="admin.created" style="width: 100%;"></el-date-picker>
      </el-col>
    </el-form-item>
    <el-form-item label="名字">
      <el-input v-model="admin.name"></el-input>
    </el-form-item>
  </el-form>
    </el-row>
  </el-card>
</template>

<script>
    export default {
        name: "AddAdmin",
      data(){
          return{
            admin:{},
          }
      },methods:{
        returns:function(){
          this.$router.push("AdminList")
        },
        addAdmin:function () {
          this.axios.post("http://localhost:8001/admin/addAdmin",this.admin).then(res=>{
            if(res.data.flag){
              alert("添加成功")
              this.$router.push("AdminList")
            }else{
              alert("添加失败")
            }
          })
        }
      },mounted(){

      }
    }
</script>

<style scoped>

</style>
